<div class="tabbable tabs-left">
              <ul class="nav nav-tabs">
              	<li><h5><?php echo $this->translate('品牌信息'); ?></h5></li>
                <li class="active"><a data-toggle="tab" href="#class_a"><?php echo $this->translate('基本信息'); ?></a></li>
                <?php if($this->brand_info) { ?>
                <li class=""><a data-toggle="tab" href="#brand_b"><?php echo $this->translate('品牌商品'); ?></a></li>
                <?php } ?>
                <li class=""><a data-toggle="tab" href="#brand_c"><?php echo $this->translate('搜索引擎优化'); ?></a></li>
              </ul>
              <form class="form-horizontal" method="post" name="brand_add_form" id="brand_add_form" enctype="multipart/form-data" action="<?php echo $this->url('brand/default',array('action'=>($this->brand_info ? 'edit' : 'add'),'controller'=>'brand','brand_id'=>($this->brand_info ? $this->brand_info->brand_id : '0'))); ?>">
              <input type="hidden" name="brand_id" id="brand_id" value="<?php echo ($this->brand_info ? $this->brand_info->brand_id : ''); ?>" />
              <input type="hidden" name="brand_save_type" id="brand_save_type" value="" />
              <div class="tab-content">
    			<div id="sticky_navigation" style="height:30px;border-bottom:4px solid #DFDFDF;">
        			<div class="pull-left" style="font-size:16px;line-height:30px;"><strong><?php if($this->brand_info) echo $this->translate('编辑'); else echo $this->translate('新加'); ?><?php echo $this->translate('商品品牌'); ?></strong></div>
        			<div id="sticky_navigation_right" class="pull-right">
                	<a href="<?php echo $this->url('brand/default',array('controller'=>'brand')); ?>" class="btn btn-small"><i class="icon-arrow-left"></i> <?php echo $this->translate('返回品牌列表'); ?></a>&nbsp;
                	<a href="<?php echo $this->serverUrl(true); ?>" class="btn btn-small btn-warning"><i class="icon-repeat icon-white"></i> <?php echo $this->translate('刷新'); ?></a>&nbsp;
                    <?php if($this->brand_info) { ?>
                    <a href="javascript:;" onclick="return brand_del_js(<?php echo $this->brand_info->brand_id ?>);" class="btn btn-small btn-danger"><i class="icon-remove icon-white"></i> <?php echo $this->translate('删除品牌'); ?></a>&nbsp;
                    <button type="submit" onclick="$('#brand_save_type').val('save_return_edit');" class="btn btn-small btn-primary"><i class="icon-ok icon-white"></i> <?php echo $this->translate('保存品牌并继续编辑'); ?></button>&nbsp;
                    <?php } ?>
                	<button type="submit" onclick="$('#brand_save_type').val('');" class="btn btn-small btn-primary"><i class="icon-ok icon-white"></i> <?php echo $this->translate('保存品牌'); ?></button>&nbsp;
                	<a href="<?php echo $this->myviewalias()->dbshopHelpUrl('goods_brand_set'); ?>" target="_blank" class="btn btn-small btn-info"><i class="icon-info-sign icon-white"></i> <?php echo $this->translate('查看帮助说明'); ?></a>
                	</div>
        		</div>
                <div id="class_a" class="tab-pane active">
                	<div class="well admin_add_header_well"><?php echo $this->translate('基本信息'); ?></div>
                	<div class="well admin_add_well">
                        <div class="message_one">
                    	</div>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('品牌名称'); ?><span class="must_add_value">*</span>：</label>
           					<div class="controls">
              					<input type="text" id="brand_name"  name="brand_name" value="<?php echo ($this->brand_info ? $this->escapeHtml($this->brand_info->brand_name) : ''); ?>" class="span12">
            				</div>                        
                        </div>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('品牌logo'); ?>：</label>
           					<div class="controls">
              					<?php if($this->brand_info and $this->brand_info->brand_logo) { ?>
              					<p id="old_brand_logo_show">
                                <img src="<?php echo $this->basePath($this->brand_info->brand_logo); ?>" style="height:80px;" border="0">
              					<a href="javascript:;" onclick="del_brand_logo(<?php echo $this->brand_info->brand_id; ?>);"><span class="badge badge-important" style="vertical-align:bottom">X</span></a>
              					</p>
              					<input type="hidden" name="old_brand_logo" id="old_brand_logo" value="<?php echo $this->brand_info->brand_logo; ?>">
              					<?php } ?>
              					<input type="file" name="brand_logo" id="brand_logo">
            				</div>                        
                        </div>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('品牌排序'); ?>：</label>
           					<div class="controls">
              					<input type="text" id="class_sort" name="brand_sort" class="span2" value="<?php if($this->brand_info and $this->brand_info->brand_sort) echo $this->brand_info->brand_sort; else echo '255'; ?>">
            				</div>                        
                        </div>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('品牌描述'); ?>：</label>
           					<div class="controls">
              					<script type="text/plain" id="brand_info" name="brand_info"><?php if($this->brand_info and $this->brand_info->brand_info) echo $this->brand_info->brand_info; ?></script>
            				</div>                        
                        </div>                                                                     
                  	</div>
                </div>
                
                <?php if($this->brand_info) { ?>             
                 <div id="brand_b" class="tab-pane">
                	<div class="well admin_add_header_well"><?php echo $this->translate('品牌商品'); ?></div>
                	<div class="well admin_add_well" style="padding:2px;">
                        <div class="message_one">
                    	</div> 
            <table class="table table-hover" id="list_goods_show">

            </table>                  
                  	</div>
                </div>
                <?php } ?>
                
                 <div id="brand_c" class="tab-pane">
                	<div class="well admin_add_header_well"><?php echo $this->translate('搜索引擎优化'); ?></div>
                	<div class="well admin_add_well">
                        <div class="message_one">
                    	</div>
                     	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('扩展标题'); ?>：</label>
           					<div class="controls">
              					<input type="text" id="brand_title_extend" value="<?php if($this->brand_info and $this->brand_info->brand_title_extend) echo $this->escapeHtml($this->brand_info->brand_title_extend); ?>"  name="brand_title_extend" class="span12">
            				</div>                        
                        </div>
                     	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('商品品牌关键词'); ?>：</label>
           					<div class="controls">
              					<textarea class="span12" rows="1" name="brand_keywords" id="brand_keywords"><?php if($this->brand_info and $this->brand_info->brand_keywords) echo $this->escapeHtml($this->brand_info->brand_keywords); ?></textarea>
            				</div>                        
                        </div>
                     	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('商品品牌描述'); ?>：</label>
           					<div class="controls">
              					<textarea class="span12" rows="3" name="brand_description" id="brand_description"><?php if($this->brand_info and $this->brand_info->brand_description) echo $this->escapeHtml($this->brand_info->brand_description); ?></textarea>
            				</div>                        
                        </div>                                          
                  	</div>                                         
              </div>
             </div>
              </form>
</div>
<?php echo $this->partial('common/editor',array('edit_array'=>array('brand_info'),
'edit_config'=>array(
"toolbars:[['FullScreen', 'Source', 'Undo', 'Redo','Bold']]",
"wordCount:false",
"initialFrameHeight:150",
"elementPathEnabled:false",
"maximumWords:500"
))); ?>

<script>
//品牌保存验证
$(document).ready(function() {
	$("#brand_add_form").validate({
		rules: {
			brand_name: {
				required: true,
				minlength:2,
				maxlength:50
			},
			brand_sort: {
				number: true,
				min:1,
				max:255
			},
			brand_title_extend: {
				maxlength:30
			},
			brand_keywords: {
				maxlength:80
			},
			brand_description: {
				maxlength:300
			}
		},
		messages: {
			brand_name: {
				required: "<?php echo $this->translate('请输入品牌名称！'); ?>",
				minlength:"<?php echo $this->translate('品牌名称最短2个字符！'); ?>",
				maxlength:"<?php echo $this->translate('品牌名称最长为50位字符！'); ?>"
			},
			brand_sort: {
				number: "<?php echo $this->translate('品牌排序必须为数字'); ?>",
				min:"<?php echo $this->translate('品牌排序最小为1'); ?>",
				max:"<?php echo $this->translate('品牌排序最大为255'); ?>"
			},
			brand_title_extend: {
				maxlength:"<?php echo $this->translate('扩展标题最长为30个字符！'); ?>"
			},
			brand_keywords: {
				maxlength:"<?php echo $this->translate('商品品牌关键字最长为80个字符！'); ?>"
			},
			brand_description: {
				maxlength:"<?php echo $this->translate('商品品牌描述最长为300个字符！'); ?>"
			}
		}
	});
});
//品牌删除操作js
function brand_del_js(brand_id) {
	if(window.confirm('<?php echo $this->translate('您确实要删除该品牌吗？'); ?>')) {
	$.post("<?php echo $this->url('brand/default',array('action'=>'del','controller'=>'brand')); ?>",{brand_id:brand_id},
	function(data){
		if(data != 'false') {
			window.location.href='<?php echo $this->url('brand/default',array('action'=>'index','controller'=>'brand')); ?>';
			return true;
		} else {
			alert('<?php echo $this->translate('品牌删除失败！'); ?>');
		}
	});
	}
	return false;
}

<?php if ($this->success_msg != '') { ?>
show_message('.message_one','<?php echo date("Y-m-d H:i:s"); ?>','<?php echo $this->success_msg; ?>','alert-success');
<?php } ?>

<?php if($this->brand_info) { ?>
//删除品牌logo
function del_brand_logo(brand_id) {
	$.post("<?php echo $this->url('brand/default',array('action'=>'dellogo','controller'=>'brand')); ?>",{brand_id:brand_id},
	function(data){
		if(data != 'false') {
			$('#old_brand_logo_show').css('display','none');
			$('#old_brand_logo').val('');
		} else {
			alert('<?php echo $this->translate('品牌logo删除失败！'); ?>');
		}
	});	
}
//ajax获取商品
dbshop_ajax_list('<?php echo $this->url('brand/default',array('action'=>'brandajaxgoods','controller'=>'brand','brand_id'=>$this->brand_info->brand_id)); ?>', 'list_goods_show');
//搜索操作
function ajax_search_class_goods() {
	var serach_url = '<?php echo $this->url('brand/default',array('action'=>'ajaxgoods','controller'=>'class','module'=>'goods','brand_id'=>$this->brand_info->brand_id)); ?>';
	serach_url     = serach_url+'/start_goods_id/'+$("#start_goods_id").val()+'/end_goods_id/'+$("#end_goods_id").val()+'/goods_name/'+$("#goods_name").val()+'/goods_item/'+$("#goods_item").val()+'/start_goods_price/'+$("#start_goods_price").val()+'/end_goods_price/'+$("#end_goods_price").val()+'/goods_state/'+$("#goods_state").val();
	dbshop_ajax_list(serach_url, 'list_goods_show');
}
<?php } ?>
</script>
